<?php
/**
 * Created by PhpStorm.
 * User: 68008000
 * Date: 2017/11/16
 * Time: 10:58
 */

namespace app\index\controller;


use think\Controller;

/**
 * Class Content
 * @package app\index\controller
 * 文章内容控制器
 */
class Content extends Common
{
    //文章主页
    public function index(){
        //处理标题
        $conf = ['title'=>'博客-详情'];

        $aid = input('param.aid');
        //1.点击次数+1
        db('article')->where('aid',$aid)->setInc('click',1);
        $aid=input('param.aid');
        //2.处理文章数据
        $data = db('article')->where('aid',$aid)->find();
        //3处理文章内容
        $articleData = db('article_data')->where('article_aid',$aid)->find();
        //处理标签
            $tagData= db('article_tag')
                ->alias('at')
                ->join('__TAG__ t','at.tag_tid = t.tid')
                ->where('at.article_aid',$aid)
                ->field(['t.tid,t.tname'])
                ->select();
        //分配变量
        $this->assign('conf',$conf);
        $this->assign('data',$data);
        $this->assign('articleData',$articleData);
        $this->assign('tagData',$tagData);
        return view();
    }
}